package com.mediacloud.app.newsmodule.fragment

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter


class PagerAdapter(
    private val fragmentList: MutableList<Fragment>,
    private val titleList: MutableList<String>?,
    fm: FragmentManager?
) : FragmentStatePagerAdapter(fm!!) {
    override fun getItem(position: Int): Fragment {
        return fragmentList[position]
    }

    override fun getCount(): Int {
        return fragmentList.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return if (titleList == null) {
            super.getPageTitle(position)
        } else {
            titleList[position]
        }
    }
    override fun getItemPosition(`object`: Any): Int {
        return androidx.viewpager.widget.PagerAdapter.POSITION_NONE
    }
}